package data_structure.mooc.filereader;

import data_structure.implement.Set;
import data_structure.mooc.LinkedList;

public class LinkedListSet<E> implements Set<E> {

    LinkedList<E>set;

    public LinkedListSet() {
        set = new LinkedList<E> ();
    }
    @Override
    public void add(E e) {
        if(!set.contains(e)){
            set.addFirst (e);
        }
    }

    @Override
    public void remove(E e) {
        set.remove (e);
    }

    @Override
    public int getSize() {
        return set.getSize ();
    }

    @Override
    public boolean isEmpty() {
        return set.isEmpty ();
    }

    @Override
    public boolean contains(E e) {
        return set.contains(e);
    }
}
